package controller.weapon
{
	import enums.weapon.WeaponViewSCPageIndex;
	
	import model.vo.weapon.BaseShortWeaponVo;
	import model.weapon.WeaponModel;
	
	import org.robotlegs.mvcs.StarlingCommand;
	
	import service.SQLService;
	
	import view.event.weapon.short_sword.ShortSwordDetailViewEvent;
	import view.event.weapon.short_sword.ShortSwordListViewEvent;
	import view.event.weapon.short_sword.ShortSwordViewEvent;
	
	
	/**
	 * 请求获取片手剑详细信息
	 * @author £iang
	 * 
	 */	
	public class GetShortSwordDetailCommand extends StarlingCommand
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** sqlService */
		[Inject]
		public var sqlService:SQLService;
		/** weaponModel */
		[Inject]
		public var weaponModel:WeaponModel;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 执行函数 
		 * 
		 */		
		override public function execute():void
		{
			var weaponData:BaseShortWeaponVo = 
				sqlService.getShortWeaponDetailInfo( weaponModel.curSearchWeaponId, "short_sword_table" );
			
			var shortSwordDetailEvent:ShortSwordDetailViewEvent = 
				new ShortSwordDetailViewEvent( ShortSwordDetailViewEvent.SHOW_DETAIL );
			
			shortSwordDetailEvent.weaponVo = weaponData;
			dispatch( shortSwordDetailEvent );
			
			var shortSwordEvent:ShortSwordViewEvent = 
				new ShortSwordViewEvent( ShortSwordViewEvent.CHANGE_PAGE );
			
			shortSwordEvent.newPage = WeaponViewSCPageIndex.DETAIL_PAGE;
			dispatch( shortSwordEvent );
			
			dispatch( new ShortSwordListViewEvent( ShortSwordListViewEvent.SCROLL_ITEM ) );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function GetShortSwordDetailCommand()
		{
			super();
		}
	}
}